home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000284_neal@ctd.comsat.com_Tue Feb 8 06:00:00 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  6KB

  1. Received: from neal.ctd.comsat.com by cs.umb.edu with SMTP id AA13586
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Tue, 8 Feb 1994 11:00:04 -0500
  3. Received: by neal.ctd.comsat.com (Smail3.1.28.1 #29)
  4.     id m0pTur5-0002fOC; Tue, 8 Feb 94 11:00 EST
  5. Message-Id: <m0pTur5-0002fOC@neal.ctd.comsat.com>
  6. Date: Tue, 8 Feb 94 11:00 EST
  7. From: neal@ctd.comsat.com (Neal Becker)
  8. To: tex-k@cs.umb.edu
  9. Subject: gsftopk + xdvik solved
  10.  
  11. I just needed to fool with MakeTeXPK.  Here is one that works for me:
  12. sorry - it still needs some cleanup
  13.  
  14. #!/bin/sh -x
  15. # original MakeTeXPK -- make a new PK font, because one wasn't found.
  16. # (If you change or delete the word `original' on the previous line,
  17. # installation won't write this MakeTeXPK over yours.)
  18. # Parameters:
  19. #
  20. #   name dpi bdpi magnification [mode]
  21. #
  22. #   `name' is the base name of the font, such as `cmr10'.
  23. #   `dpi' is the resolution the font is needed at.
  24. #   `bdpi' is the base resolution, used to intuit the mode to use.
  25. #   `magnification' is a string to pass to MF as the value of `mag'.
  26. #   `mode', if supplied, is the mode to use.
  27. #
  28. # This script must echo the name of the generated PK file (and nothing
  29. # else) to standard output. Yes, this is different from the original dvips.
  30.  
  31. echo "Running MakeTeXPK $*" 1>&2
  32.  
  33. # Where to put the new file. The Makefile substitutes for this value.
  34. #: ${DESTDIR=${MTP_DESTDIR-/usr/local/lib/texmf/fonts/tmp/pk}}
  35.  
  36. # Define to `gsftopk' or `ps2pk' or whatever to make PK files for
  37. # PostScript fonts. If this is defined, MAPFILE must also be defined to
  38. # be your psfonts.map file or some equivalent. The Makefile substitutes
  39. # for this, too. You can get gsftopk from
  40. # math.berkeley.edu:pub/Software/TeX/gsftopk.tar.Z.
  41. : ${gsftopk=/usr/local/bin/gsftopk}
  42. : ${MAPFILE=/usr/local/lib/texmf/dvips/psfonts.map}
  43.  
  44. # If this directory doesn't exist, the Sauter stuff won't be attempted.
  45. : ${sauterdir=/usr/local/src/TeX+MF/tex82/utilities/sauter}
  46.  
  47. # Likewise, for the F3 stuff.
  48. : ${f3dir=/groups/dtrg/typescaler/fonts/f3b}
  49.  
  50. # TEMPDIR needs to be unique for each process because of the possibility
  51. # of simultaneous processes running this script.
  52. TEMPDIR=${TMPDIR-/tmp}/mtpk.$$
  53.  
  54. NAME=$1
  55. DPI=$2
  56. BDPI=$3
  57. MAG=$4
  58. MODE=$5
  59.  
  60. # If an explicit mode is not supplied, try to guess. You can get a
  61. # complete list of extant modes from ftp.cs.umb.edu:pub/tex/modes.mf.
  62. if test -z "$MODE"; then
  63.   case "$BDPI" in
  64.     85) MODE=sun;;
  65.    118) MODE=lview;;
  66.    300) MODE=CanonCX;;
  67.    600) MODE=ljfour;;
  68.   1270) MODE=LinotypeOneZeroZero;;
  69.      *) echo "MakeTeXPK doesn't have a guess for $BDPI dpi devices." 1>&2
  70.         echo "Put the mode in a config file, or update MakeTeXPK." 1>&2
  71.         exit 1
  72.   esac
  73. fi
  74.  
  75. DESTDIR=/usr/local/lib/texmf/fonts/$MODE
  76.  
  77. umask 0
  78.  
  79. GFNAME=$NAME.$DPI'gf'
  80. PKNAME=$NAME.$DPI'pk'
  81.  
  82. # Have we been spuriously called? No harm done, if so.
  83. if test -r $DESTDIR/$PKNAME; then
  84.   echo "$DESTDIR/$PKNAME already exists!" 1>&2
  85.   echo $DESTDIR/$PKNAME
  86.   exit 0
  87. fi
  88.  
  89. # Clean up on normal or abnormal exit.
  90. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  91.  
  92. # Do we have a GF file in the current directory?
  93. if test -r $GFNAME; then
  94.   echo "gftopk ./$GFNAME $PKNAME" 1>&2
  95.   gftopk ./$GFNAME $PKNAME
  96.   # Don't move the font; if the person knows enough to make fonts, they
  97.   # know enough to have . in the font paths.
  98.   echo $PKNAME
  99.   exit 0
  100. fi
  101.  
  102. # Do we have an F3 font?
  103. if test -r $f3dir/$NAME.f3b; then
  104.   # You will need Sun's f3tobm program, plus a program I wrote.
  105.   # See ftp.cs.umb.edu:private/f3totex.
  106.   cd $f3dir || exit 1
  107.   echo "f3topk -r $DPI $NAME" 1>&2
  108.   if f3topk -r $DPI $NAME; then
  109.     # Best if f3topk echoes its output filename, I think.
  110.     exit 0
  111.   else
  112.     echo "f3topk failed." 1>&2
  113.     exit 1
  114.   fi
  115. fi
  116.  
  117. # Is this a PostScript font?
  118. if test -n "$gsftopk" && egrep \^$NAME'([     ]|$)' $MAPFILE >/dev/null; then
  119.   echo "Running $gsftopk $NAME $DPI." 1>&2
  120.   $gsftopk $NAME $DPI 1>&2
  121.   if test $? -ne 0; then
  122.     echo "$gsftopk failed."
  123.     exit 1
  124.   fi
  125. else
  126.   
  127. # We're down to trying Metafont.  Since we want to run it in a
  128. # temporary directory, add the current directory to MFINPUTS.
  129. MFINPUTS=`pwd`:${MFINPUTS}:
  130. export MFINPUTS
  131.  
  132. test -d $TEMPDIR || mkdir $TEMPDIR 
  133. cd $TEMPDIR || exit 1
  134.  
  135. # Which version of Metafont shall we use?
  136. case $NAME in
  137.   cm*) mf=cmmf;;
  138.     *) mf=mf;;
  139. esac
  140.  
  141.  
  142. # Run Metafont. 
  143. echo "Running $mf \mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" 1>&2
  144. $mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null 1>&2
  145.  
  146. if test -d $sauterdir && test $? -eq 1 && test $mf = cmmf; then
  147.   echo "Trying interpolated/extrapolated (Sauter) CM source." 1>&2
  148.   # Perhaps no such MF source file, and it's CM.  Try Sauter's scripts.
  149.   cd $sauterdir
  150.   rootfont=`echo $NAME | sed 's/[0-9]*$//'`
  151.   pointsize=`echo $NAME | sed 's/^\(.*\)\([0-9]*\)$/\1/'`
  152.   make-mf $rootfont $pointsize
  153.   $mf "\mode:=$MODE; mag:=$MAG; scrollmode; input mf/$NAME" </dev/null
  154.   if test $? -eq 0 && test -r $GFNAME; then
  155.     mv $GFNAME $TEMPDIR
  156.   fi
  157.   rm -f $NAME.log mf/$NAME
  158.   cd $TEMPDIR
  159. fi
  160.  
  161. if test ! -r $GFNAME; then
  162.   # Maybe it succeeded at DPI +- 1?  Annoying to have to check for this,
  163.   # but means we can use floating-point in the sources, so fine.
  164.   test_dpi=`expr $DPI - 1`
  165.   test_name=$NAME.${test_dpi}
  166.   if test -r ${test_name}gf; then
  167.     GFNAME=${test_name}gf
  168.     PKNAME=${test_name}pk
  169.   else
  170.     test_dpi=`expr $DPI + 1`
  171.     test_name=$NAME.${test_dpi}
  172.     if test -r ${test_name}gf; then
  173.       GFNAME=${test_name}gf
  174.       PKNAME=${test_name}pk
  175.     else
  176.       echo "MakeTeXPK failed to make $GFNAME." 1>&2
  177.       exit 1
  178.     fi
  179.   fi
  180. fi
  181.  
  182. # Metafont succeeded.  Make the PK file.
  183. gftopk ./$GFNAME $PKNAME
  184.  
  185. fi
  186. test -d $DESTDIR \
  187.   || mkdir $DESTDIR \
  188.   || (echo "${DESTDIR}: MakeTeXPK could not create directory." 1>&2; exit 1)
  189.  
  190. # Install the PK file carefully, since others may be working simultaneously.
  191. mv $PKNAME $DESTDIR/pktmp.$$ \
  192.   || (echo "$0: Could not mv $PKNAME $DESTDIR/pktmp.$$." 1>&2; exit 1)
  193.  
  194. cd $DESTDIR || exit 1
  195. mv pktmp.$$ $PKNAME
  196.  
  197. # If this line (or an equivalent) is not present, dvipsk/xdvik will think
  198. # MakeTeXPK failed.  Any other output to stdout will likewise lose.
  199. echo $DESTDIR/$PKNAME